<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link rel='stylesheet' href='../lib/cupertino/jquery-ui.min.css' />
<link href='../fullcalendar.css' rel='stylesheet' />
<link href='../fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='../lib/moment.min.js'></script>
<script src='../lib/jquery.min.js'></script>
<script src='../lib/jquery-ui.custom.min.js'></script>
<script src='../fullcalendar.min.js'></script>
<script src='../lang-all.js'></script>
<script>

	$(document).ready(function() {
		var currentLangCode = 'zh-cn';

		// build the language selector's options
///				url: 'php/get-events.php',
	//			error: function() {
		//			$('#script-warning').show();
		//		}
		
		function renderCalendar() {
			$('#calendar').fullCalendar({
				header: {
					left: 'today',
					center: 'title',
					right: 'month'
				},
				defaultDate: '2014-10',
				lang: currentLangCode,
				buttonIcons: false, // show the prev/next text
				weekNumbers: true,
				editable: false,
				events: [
					{
						title: 'All Day Event',
						start: '2014-10-01'
					},
					{
						title: 'Long Event',
						start: '2014-10-07',
						end: '2014-10-10'
					},
					{
						id: 999,
						title: 'Repeating Event',
						start: '2014-10-09T16:00:00'
					},
					{
						id: 999,
						title: 'Repeating Event',
						start: '2014-10-16T16:00:00'
					},
					{
						title: 'Meeting',
						start: '2014-10-12T10:30:00',
						end: '2014-10-12T12:30:00'
					},
					{
						title: 'Lunch',
						start: '2014-10-12T12:00:00'
					},
					{
						title: 'Birthday Party',
						start: '2014-10-13T07:00:00'
					},
					{
						title: 'Click for Google',
						url: 'http://google.com/',
						start: '2014-10-28'
					}
				],
				eventClick: function(event) {
					// opens events in a popup window
					window.open(event.url, 'gcalevent', 'width=700,height=600');
					return false;
				},
				select: function(start, end) {
					//ajax操作
					var title = prompt('Event Title:');
					var eventData;
					if (title) {
						eventData = {
							title: title,
							start: start,
							end: end
						};
						$('#calendar').fullCalendar('renderEvent', eventData, false); // stick? = true
					}
					$('#calendar').fullCalendar('unselect');
				}
				
			});
		}

		renderCalendar();
	});

</script>
<style>

	body {
		margin: 0;
		padding: 0;
		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
		font-size: 14px;
	}

	#top {
		background: #eee;
		border-bottom: 1px solid #ddd;
		padding: 0 10px;
		line-height: 40px;
		font-size: 12px;
	}

	#calendar {
		width: 900px;
		margin: 40px auto;
	}
	#calendar {
		width: 900px;
		margin: 40px auto;
	}
</style>
</head>
<body>


	<div id='calendar'></div>

</body>
</html>
